Translatable

interface Translatable

Classes that implement Translatable can be automatically utilized by many FzzyConfig systems for generating translatable text in-game

Author

fzzyhmstrs

Since

0.2.0, added prefixes 0.6.0

Samples

import me.fzzyhmstrs.fzzy_config.util.Translatable

fun main() { 
   //sampleStart 
   class ExampleTranslatable: Translatable {
    override fun translationKey(): String {
        return "my.config.cool.translation"
    }

    override fun descriptionKey(): String {
        return "my.config.cool.translation.desc"
    }
} 
   //sampleEnd
}

Inheritors

Types

Link copied to clipboard

Description string for data generation or used as a "fallback" description implementation. Outputs in the lang file will have the suffix ".desc". Use this on the config class itself to translate the config description for a config screen button in the landing page.

Link copied to clipboard
object Impls
Link copied to clipboard

Name string for data generation or used as a "fallback" name implementation. Use this on the config class itself to translate the config name.

Link copied to clipboard

Prefix string for data generation or used as a "fallback" name implementation. Outputs in the lang file will have the suffix ".prefix". Use this on the config class itself to translate the config prefix for a header and to put above a config screen button in the landing page.

Link copied to clipboard

Abstract representation of a translation result. Implementations of this class may or may not have all three translation components

Link copied to clipboard
object Utils

Provides utilities for creating and caching translation results

Functions

Link copied to clipboard
open fun description(fallback: String? = null): MutableText

The translated Text description from the descriptionKey. Falls back to an empty string so no tooltip is rendered.

Link copied to clipboard
abstract fun descriptionKey(): String

translation key of this Translatable description. the "description" in-game, the descriptions Enchantment Descriptions adds to enchantment tooltips are a good example.

Link copied to clipboard
open fun descriptionOrNull(fallback: String? = null): MutableText?

The translated Text description from the descriptionKey. Falls back to an empty string so no tooltip is rendered. If no translation exists when called returns null.

Link copied to clipboard

Whether this Translatable has a valid description

Link copied to clipboard
open fun hasPrefix(): Boolean

Whether this Translatable has a valid prefix

Link copied to clipboard

Whether this Translatable has a valid translation

Link copied to clipboard
open fun prefix(fallback: String? = null): MutableText

The translated Text description from the descriptionKey. Falls back to an empty string so no tooltip is rendered.

Link copied to clipboard
open fun prefixKey(): String

translation key of this Translatable inline prefix text. Unlike descriptions, which are usually displayed in-tooltips, prefixes are displayed inline in the config screen itself

Link copied to clipboard
open fun prefixOrNull(fallback: String? = null): MutableText?

The translated Text description from the descriptionKey. Falls back to an empty string so no tooltip is rendered. If no translation exists when called returns null.

Link copied to clipboard
open fun translation(fallback: String? = null): MutableText

The translated Text name from the translationKey. Falls back to the implementing classes Simple Name (non-translated)

Link copied to clipboard
abstract fun translationKey(): String

translation key of this Translatable. the "name" in-game

Link copied to clipboard
open fun translationOrNull(fallback: String? = null): MutableText?

The translated Text name from the translationKey. Falls back to the implementing classes Simple Name (non-translated). If no translation exists when called returns null.